<template>
  <div class="container">
    <router-view></router-view>
    <div class="index">
      <Header />
      <div class="main" @click="isView = false">
        <div class="main-top">
          <div class="con-menu"  @click="prepareLessons()">
            <div class="menu-img">
              <img src="../../static/img/book.png" alt="">
            </div>
            <div class="menu-item">
              备课
            </div>
          </div>
          <div class="con-menu"  @click="attendClass()">
            <div class="menu-img">
              <img src="../../static/img/shangke.png" alt="">
            </div>
            <div class="menu-item">
              上课
            </div>
          </div>
        </div>
        <div class="main-bottom">
          <div class="con-menu"  @click="students()">
            <div class="menu-img">
              <img src="../../static/img/student.png" alt="">
            </div>
            <div class="menu-item">
              学生
            </div>
          </div>
          <div class="con-menu2"  @click="resource()">
            <div class="menu-img">
              <img src="../../static/img/resources.png" alt="">
            </div>
            <div class="menu-item">
              资源
            </div>
          </div>
          <div class="con-menu3"  @click="my()">
            <div class="menu-img">
              <img src="../../static/img/wode.png" alt="">
            </div>
            <div class="menu-item">
              我的
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="r-fix-menu"  @click="isView = true" v-if="isView == false">
      <span class="sp"> 桌面版</span>
    </div>
    <div class="r-fix-menu2"  v-if="isView == true">
      <h3> 下载桌面版获得更佳体验</h3>
      <a class="download" href="https://admin.jiaodehuiyun.com/client/jiaodehui.exe" download="https://admin.jiaodehuiyun.com/client/jiaodehui.exe"  @click="downloadapp()" >  <img src="../../static/img/download.png" alt=""></a>
      <p>适用于win7 64位或以上系统</p>
    </div>

  </div>
</template>

<script>
import Header from '../components/header.vue';
export default {
  data() {
    return {
      isView:false,
       userAuth:JSON.parse(localStorage.getItem('userAuth'))
    };
  },
  created() {
    this.checkAuth();
    this.userAuth = JSON.parse(localStorage.getItem('userAuth'));
  },
  methods: {
    checkAuth(){
      let userAuth = JSON.parse(localStorage.getItem('userAuth'));
      let jump_url =   userAuth.jump_path;
      console.log("jump_url:" + jump_url)
      if(jump_url == '/train' ){
        this.$router.push(jump_url);
      }
    },
    prepareLessons(){
      this.$router.push("/lessonsadd");
    },
    attendClass(){
      this.$router.push("/bkblist");
    },
    students(){
      this.$router.push("/students");
    },
    resource(){
      if(this.userAuth.is_resource) {
        this.$router.push("/courseList");
      }else{
        this.$message.error('该模块未授权，请联系管理员');
      }

    },
    my(){
      this.$router.push("/profile");
    },
    downloadapp(){
      this.isView = false;
    }
  },
  components:{Header}
};
</script>

<style lang="scss" scoped>
</style>
